<?php

use yii\helpers\Html;
use yii\grid\GridView;
use mdm\admin\components\Helper;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'car Brands');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="car-brand-index">
    <h1><?= Html::encode($this->title) ?></h1>
    <p>
        <?= Html::a(Yii::t('app', 'Create car Brand'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'pre',
            'title',
            ['attribute' => 'image','format' => ['image',['width'=>'40','height'=>'40']],
                'value' => function ($model) {
                    return $model->image;
                }],
            ['class' => 'yii\grid\ActionColumn'],
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => Helper::filterActionColumn(['car_id', 'car-list']),
                'buttons' => [
                    'car-list' => function ($url, $model) {
                        return Html::a('系列车型', $url, ['title' => '系列车型']);
                    }
                ]
            ],
        ],
    ]); ?>
</div>
